/******************************************************************
 * @version      : 1.0
 * @Author       : zhl
 * @Date         : 2023-06-19 14:48:21
 * @LastEditors  : zhl
 * @E-Mail       : zhll168@163.com
 * @Description  : 命令相关
 ******************************************************************/

#ifndef __COMMAND_MANAGER_H__
#define __COMMAND_MANAGER_H__
#include <memory>
#include <string>
#include "CMosquittoManager.h"

class CommandManager{
private:
    /* data */
    static CommandManager *c_instance;
    std::string c_sn;
    static bool c_is_singleton;
    int64_t c_req_id;

private:
    static void cmd_execute_thread(CommandManager *cm, std::string cmd, int64_t req_id);
    std::string execute(char *cmd);
    std::string get_cmd_result_report_data(std::string &result, int64_t req_id);

public:
    std::shared_ptr<CMosquittoManager> c_mm;

public:
    CommandManager(/* args */);
    ~CommandManager();

    static CommandManager* getInstance();
    void init(std::shared_ptr<CMosquittoManager> mm, char* sn);
    void exec_cmd(std::string cmd, int64_t req_id);
};



#endif /* __COMMAND_MANAGER_H__ */